package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.NursingProjectVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("/customer/orders/project")
public class CostomerNursingProjectController {
    @Autowired
    private NursingProjectService projectService;


    /**
     * 小程序分页查询护理项目列表
     * @param name
     * @param status
     * @param pageNum
     * @param pageSize
     * @return
     */
    @GetMapping("/page")
    public ResponseResult<PageResponse<NursingProjectVo>> getList(@RequestParam(required = false) String name,
                                                                 @RequestParam(required = false) Integer status,
                                                                 @RequestParam Integer pageNum,
                                                                 @RequestParam Integer pageSize){
        log.info("小程序分页查询护理项目列表接口，入参name={},status={},pageNum={},pageSize={}",name,status,pageNum,pageSize);
        PageResponse<NursingProjectVo> projectVos = projectService.getList(name,status,pageNum,pageSize);
        return ResponseResult.success(projectVos);
    }

    /**
     * 小程序查询护理项目信息
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public ResponseResult<NursingProjectVo> getById(@PathVariable Long id){
        log.info("小程序查询护理项目信息接口，入参id={}",id);
        NursingProjectVo projectVo = projectService.getById(id);
        return ResponseResult.success(projectVo);
    }
}
